pdfium-ports
authorDebian LibreOffice Maintainers <debian-openoffice@lists.debian.org>
Sat, 13 Dec 2025 08:32:27 +0000 (09:32 +0100)
committerRene Engelhard <rene@debian.org>
Sat, 13 Dec 2025 08:32:27 +0000 (09:32 +0100)
Gbp-Pq: Name pdfium-ports.diff

external/pdfium/0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch [new file with mode: 0644]
external/pdfium/UnpackedTarball_pdfium.mk
external/pdfium/debian-ports.diff [new file with mode: 0644]

diff --git a/external/pdfium/0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch b/external/pdfium/0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch
new file mode 100644 (file)
index 0000000..3ddd36d
--- /dev/null
@@ -0,0 +1,50 @@
+>From 1c815bec0324037494840d01fc579f2a3420e624 Mon Sep 17 00:00:00 2001
+From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Date: Thu, 27 Nov 2025 13:22:22 +0100
+Subject: [PATCH] core/fxcrt/numerics: Fix incorrect preprocessor check on
+ aarch64
+
+The preprocessor macro to toggle the use of safe_math_arm_impl.h
+currently checks whether __ARMEL__ or __arch64__ are defined. However,
+on aarch64, the actual define is called __aarch64__ not __arch64__:
+
+(sid_arm64-dchroot)glaubitz@amdahl:~$ uname -a
+Linux amdahl 6.12.57+deb13-arm64 #1 SMP Debian 6.12.57-1 (2025-11-05) aarch64 GNU/Linux
+(sid_arm64-dchroot)glaubitz@amdahl:~$ echo | gcc -E -dM -|grep arch
+(sid_arm64-dchroot)glaubitz@amdahl:~$
+
+However, the define __arch64__ is used on sparc64:
+
+(sid_sparc64-dchroot)glaubitz@stadler:~$ uname -a
+Linux stadler 6.17.0-rc5+ #1 SMP Fri Sep 12 20:37:32 UTC 2025 sparc64 GNU/Linux
+(sid_sparc64-dchroot)glaubitz@stadler:~$ echo | gcc -E -dM -|grep arch
+(sid_sparc64-dchroot)glaubitz@stadler:~$
+
+This triggers the use of safe_math_arm_impl.h on sparc64 which causes
+the compiler to emit the "qsub" instruction which is not recongized:
+
+/tmp/ccLEFgM7.s: Assembler messages:
+/tmp/ccLEFgM7.s:10332: Error: Unknown opcode: `qsub'
+/tmp/ccLEFgM7.s:10365: Error: Unknown opcode: `qsub'
+
+Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+---
+ core/fxcrt/numerics/safe_math_clang_gcc_impl.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/core/fxcrt/numerics/safe_math_clang_gcc_impl.h b/core/fxcrt/numerics/safe_math_clang_gcc_impl.h
+index 58419d5c9..d395ebd3e 100644
+--- core/fxcrt/numerics/safe_math_clang_gcc_impl.h
++++ core/fxcrt/numerics/safe_math_clang_gcc_impl.h
+@@ -14,7 +14,7 @@
+ #include "core/fxcrt/numerics/safe_conversions.h"
+-#if !defined(__native_client__) && (defined(__ARMEL__) || defined(__arch64__))
++#if !defined(__native_client__) && defined(__ARMEL__)
+ #include "core/fxcrt/numerics/safe_math_arm_impl.h"
+ #define BASE_HAS_ASSEMBLER_SAFE_MATH (1)
+ #else
+-- 
+2.47.3
+
index bf93dcd2e09af5e1b8e90dca8aa4ebaa80b935aa..f522191bd8cf8ef095d14f8a942b7e261d2871f3 100644 (file)
@@ -23,6 +23,9 @@ ifeq ($(OS),WNT)
 pdfium_patches += pdfium-vs2019-arm64_no-__umulh.patch.1
 endif
 
+pdfium_patches += debian-ports.diff
+pdfium_patches += 0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch
+
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,pdfium,$(PDFIUM_TARBALL)))
diff --git a/external/pdfium/debian-ports.diff b/external/pdfium/debian-ports.diff
new file mode 100644 (file)
index 0000000..1d9b140
--- /dev/null
@@ -0,0 +1,28 @@
+--- build/build_config.h       2024-03-05 16:50:08.624785549 +0100
++++ build/build_config.h       2024-03-05 16:50:55.616839071 +0100
+@@ -350,6 +350,25 @@
+ #define ARCH_CPU_RISCV64 1
+ #define ARCH_CPU_64_BITS 1
+ #define ARCH_CPU_LITTLE_ENDIAN 1
++#elif defined(__sparc__)
++#define ARCH_CPU_BIG_ENDIAN 1
++#if defined(__arch64__)
++#define ARCH_CPU_64_BITS 1
++#else
++#define ARCH_CPU_32_BITS 1
++#endif
++#elif defined(__m68k__)
++#define ARCH_CPU_32_BITS 1
++#define ARCH_CPU_BIG_ENDIAN 1
++#elif defined(__hppa__)
++#define ARCH_CPU_32_BITS 1
++#define ARCH_CPU_BIG_ENDIAN 1
++#elif defined(__alpha__)
++#define ARCH_CPU_64_BITS 1
++#define ARCH_CPU_LITTLE_ENDIAN 1
++#elif defined(__ia64__)
++#define ARCH_CPU_64_BITS 1
++#define ARCH_CPU_LITTLE_ENDIAN 1
+ #else
+ #error Please add support for your architecture in build/build_config.h
+ #endif